#include <iostream>
#include <algorithm>
#include <cstring>

using namespace std;
using LL = long long;
const int N = 2e5 + 10;

int n;
int q[N], tr[N];
LL hightleft[N], highright[N];
LL lowleft[N], lowright[N];


int lowbit(int x){
    return (-x) & x;
}

int add(int x, int k){
    for(int i = x; i <= n; i += lowbit(i)){
        tr[i] += k;
    }
}

int f(int x){
    int res = 0;
    for(int i = x; i > 0; i -= lowbit(i)){
        res += tr[i];
    }
    return res;
}

int sum(int l, int r){
    return f(r) - f(l - 1);
}

int main(){
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);

    scanf("%d", &n);
    for(int i = 1; i <= n; i ++) scanf("%d", &q[i]);

    for(int i = 1; i <= n; i ++){
        lowleft[i] = sum(1, q[i]);
        hightleft[i] = sum(q[i], n);
        add(q[i], 1);
    }

    memset(tr, 0, sizeof tr);
    for(int i = n; i >= 1; i --){
        lowright[i] = sum(1, q[i]);
        highright[i] = sum(q[i], n);
        add(q[i], 1);
    }

    LL res1 = 0, res2 = 0;
    for(int i = 1; i <= n; i ++){
        res1 = (LL) res1 + (LL) hightleft[i] * highright[i];
        res2 = (LL) res2 + (LL) lowleft[i] * lowright[i];
    }

    printf("%lld %lld", res1, res2);

    return 0;
}